execcommand insert video

53

insertYouTube: function () { /* This can be improved */		var urlPrompt = prompt("Enter Youtube Url:", "http://");		var urlReplace = urlPrompt.replace("watch?v=", "embed/");		var embed = '<iframe title="YouTube video player" src="'+urlReplace+'" allowfullscreen="true" width="480" frameborder="0" height="390">';		if($.browser.msie){			document.createRange().pasteHTML(embed)		}else{			document.execCommand("Inserthtml", false, embed);		}		}

Comments

Submit
0 Comments